function PlotVelocityFieldPhase(velocityfield,parameters,Traj,TrajInFrames,objects,slice)
ON=parameters.ON;
TN=parameters.TN;


FILE1 = parameters.phasefilenames{slice(1)};
%FILE2 = parameters.phasefilenames{slice(2)};

x=velocityfield{slice(1)}{1};
y=velocityfield{slice(1)}{2};
fu=velocityfield{slice(1)}{5};
fv=velocityfield{slice(1)}{6};

figure
    %set(gcf,'PaperUnits','inches','PaperPosition',[0 0 10 10]) 
    %axis square
    %axis xy
    %hold on
    A=imread(FILE1);
  
    imagesc(A);
    %imshow(A)
    colormap('gray')
    hold on
      %B=imread(FILE2);
%     himage = imagesc(B);
%     colormap('gray')
%     set(himage, 'AlphaData', 0.3);
    
    
%     quiver(x,y,up,vp, 'Color', 'r', 'LineWidth', 1);
    %quiver(x,y,u,v, 'r');
    quiver(x,y,fu(2:end,2:end),fv(2:end,2:end), 'w');
    %quiver(x,y,fu,fv, 'Color', 'r', 'LineWidth', 1);
    hold off;    
   xlim([min(min(x)) - 128 max(max(x)) + 128])
   ylim([min(min(y)) - 128 max(max(y)) + 128])
    %save(sprintf('VELDATA%03g',i), 'x','y','u','v','up','vp');
     %print('-dpng',[outdir, sprintf('velfield%03g.png',27)],'-r100');
     
%      figure
%      set(gcf,'PaperUnits','inches','PaperPosition',[0 0 10 10])
%      clf
%     axis square
%     %axis xy
%     hold on
%     A=imread(FILE2);
%     imagesc(A);
%     colormap('gray')
% %     quiver(x,y,up,vp, 'Color', 'r', 'LineWidth', 1);
%     quiver(x,y,up,vp, 'Color', 'r', 'LineWidth', 1);
%     hold off;    
%    xlim([min(min(x)) - 128 max(max(x)) + 128])
%    ylim([min(min(y)) - 128 max(max(y)) + 128])
% %     save(sprintf('VELDATA%03g',i), 'x','y','u','v','up','vp');
% 
%      print('-dpng',[outdir sprintf('velfield%03g.png',28)],'-r100');
    
    
    %write cell trajectory numbers
    TrajInCurrentFrame=TrajInFrames{slice};

    for i=1:length(TrajInCurrentFrame)

        frameArray=Traj{TrajInCurrentFrame(i)}(:,TN.frame)==slice;
        if(any(frameArray))    

            objectNum=Traj{TrajInCurrentFrame(i)}(frameArray,TN.object);
            
            text(objects{slice}(objectNum,ON.CentroidX),objects{slice}(objectNum,ON.CentroidY),...
                num2str(TrajInCurrentFrame(i)),'Color','r');
        end
    end
        
    
    
    %drawnow;
%     for i=1:length(traj)
%         
%         if(any([traj{i}.frame]==slice(1)))
%             objectNum=traj{i}([traj{i}.frame]==slice(1)).object;
%             
%             if(~isnan(objectNum))
%                 centroid=objects{slice(1)}(objectNum).Centroid;
%                % if(strcmp(options,'number'))
%                     text(centroid(1),centroid(2),num2str(i),'Color','w');
%                 %elseif(strcmp(options,'Area'))
%                 %    text(centroid(1),centroid(2),sprintf('%u',objects{slice}(objectNum).Area),'Color','w');
%                 %elseif(strcmp(options,'Eccentricity'))
%                 %    text(centroid(1),centroid(2),sprintf('%0.3f',objects{slice}(objectNum).Eccentricity),'Color','w');
%                 %end
%             end
%         end
%     end

%end